Write a custom CUDA kernel to optimize `HardSReLUE`.

Formula:
  f(x) = a * (exp(x) - 1)                      if x < 0
  f(x) = a*x*max(0, min(1, 0.5x+0.5)) + x    if x >= 0

Problem Analysis:
1. Computationally Intensive & Memory Bound: The operation is element-wise but has multiple branches and involves exp, min, max, mul, add.
2. Operator Chaining: A PyTorch implementation using `torch.where` would create numerous intermediate tensors.

Optimization Strategy: Fused Element-wise Kernel with Vectorization

1. One-Thread-per-Element: Map each element to a CUDA thread.

2. Vectorized Loads (float4): Use `float4` to process 128 bits per memory transaction.

3. Fused Branching Logic:
   - For each element `x`, check `if (x < 0)`.
   - If true: `a * (__expf(x) - 1.0f)`.
   - If false: `hardsig_part = fminf(fmaxf(0.5f * x + 0.5f, 0.0f), 1.0f)`, then `a*x*hardsig_part + x`.
   - All computations are fused in registers.

4. One-Pass: Fuse all steps into a single read-compute-write kernel.
  
Here's an example to show you the syntax of inline embedding custom CUDA operators in torch: The example given architecture is:   
  
```python
import torch
import torch.nn as nn

BATCH_SIZE = 4096
HIDDEN_DIM = 4096
SHAPE = (BATCH_SIZE, HIDDEN_DIM)

# HardSReLUE 超参数 a ,论文中设为 0.2
ALPHA_VALUE = 0.2

class HardSReLUE(nn.Module):
    '''
    A novel nonlinear hybrid HardSReLUE activation function
    https://link.springer.com/content/pdf/10.1007/s11042-022-14313-w.pdf

    Formula:
      f(x) = a * (exp(x) - 1)                      if x < 0
      f(x) = a*x*max(0, min(1, 0.5x+0.5)) + x      if x >= 0
    '''
    def __init__(self, alpha=0.2):
        super(HardSReLUE, self).__init__()
        self.alpha = alpha

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        # Negative part
        neg_part = self.alpha * (torch.exp(x) - 1.0)
        
        # Positive part
        hardsig_part = torch.clamp(0.5 * x + 0.5, 0.0, 1.0)
        pos_part = self.alpha * x * hardsig_part + x
        
        return torch.where(x < 0, neg_part, pos_part)

class Model(nn.Module):
    def __init__(self, alpha=0.2):
        super(Model, self).__init__()
        self.act = HardSReLUE(alpha=alpha)
    
    def forward(self, x):
        return self.act(x)

def get_inputs():
    input_tensor = torch.randn(SHAPE, dtype=torch.float32) * 5.0
    return [input_tensor.contiguous()]

def get_init_inputs():
    return [ALPHA_VALUE]